#pragma once

#include <string>
#include <set>
#include <functional>
#include "Singleton.h"
#include "MsgRouter.h"
#include "accountmgr.h"

class AccountService
{
public:
    bool Init();

public:
    AccountService() = default;
    virtual ~AccountService() = default;

public:
    static AccountService* Instance()
	{
		return CSingleton<AccountService>::Instance();
	}

public:
    enum Sence
    {
        NOTIFY = 100, //通知
    };
public:
    bool HandleGetAccount(const std::uint32_t& uid, std::string&& trans, Sence sence);
    void OnAccountGet(MsgData&& data);
    void OnSenceAccountGet(Sence sence, std::string&& trans, std::int32_t err_code, Account* pAccount);
    inline void ListenOnAccountGet(Sence sence, std::function<void(std::int32_t err_code, Account* pAccount, std::string&& trans)> listen)
    {
        m_account_get_listen[sence] = listen;
    }
private:
    std::map<Sence, std::function<void(std::int32_t err_code, Account* pAccount, std::string&& trans)>> m_account_get_listen;

};